<?php echo fx_control::newInstance('formKey')->createType('hidden')->setData('value', random_string('unique', 16))->render(); ?>
<div class="gridContainer autoCenter">
	<!-- GRID HEADER -->
	<div class="gridHeader block">
		<table class="fullWidth">
			<tr>
				<td class="column50">
					<h3 class="moduleHeader">
						Manga Management
					</h3>
				</td>
				<td class="column50 rightAlign">
					<button type="button" onclick="window.location='<?php echo site_url("admin/catalog/manga/edit", true)?>'">
						<span>Add New Manga</span>
					</button>
				</td>
			</tr>
		</table>
	</div>
	<!--TOOL-->
	<div class="gridTools block">
		<table class="fullWidth">
		<tr>
			<td>
				Page
				<input type="text" class="inputText pageIndex" value="<?php echo $paginator->getCurrentPageNumber() ?>" name="page" style="width:20px"/>
				of <?php echo $paginator->count() ?> pages
				<span class="separator">|</span>
				View
				<?php echo fx_control::newInstance('recordPerPage')
							 ->createType('option')
							 ->addOption('20', 20)
							 ->addOption('30', 30)
							 ->addOption('50', 50)
							 ->addOption('100', 100)
							 ->addOption('200', 200)
							 ->addClass('selectRecordPerPage')
							 ->bindingOption($paginator, 'getItemCountPerPage')
							 ->render(); 
				?>
				on page
				<span class="separator">|</span>
				Found
				<span class="no-display" id="total-count"><?php echo $found; ?></span> manga
			</td>
			<td align="right">
				&nbsp;
			</td>
			<td align="right">
				<div align="right" class="buttonSet">
					<button type="submit">
						<span>Search</span>
					</button>
					<button type="reset" onclick="window.location='<?php echo site_url('admin/catalog/manga/index', true)?>'">
						<span>Reset Filter</span>
					</button>
				</div>
			</td>
		</tr>
		</table>
	</div>
				
        <!--PRODUCT COLLECTION-->
	<table class="gridview" id="gridview">
		<thead>
		<!--COLUMN HEADER-->
		<tr class="columns">
			<input type="hidden" name="mangaOrder[name]" value="<?php echo $sorter->getName() ?>" id="mangaOrder"/>
			<input type="hidden" name="mangaOrder[direction]" value="<?php echo $sorter->getDirection() ?>" id="mangaOrderDirection"/>
			<th><span></span></th>
			<th id="manga_id" class="columnFilter"><span>ID</span></th>
			<th id="manga_name" class="columnFilter"><span>Name</span></th>
			<th id="manga_author" class="columnFilter"><span>Author</span></th>
			<th id="manga_publisher" class="columnFilter"><span>Publisher</span></th>
		</tr>
		<!--COLUMN FILTER-->
		<tr class="filters">
			<th style="width: 30px"></th>
			<th style="width: 120px">
				<div class="clear">
					<span class="filterLabel left">From</span>
					<input class="filterField left" type="text" name="mangaFilter[id][value][from]" value="<?php echo $filters->getValueFrom('id'); ?>"/>
					<input type="hidden" name="mangaFilter[id][type]" value="range"/>
				</div>
				<div class="clear">
					<span class="filterLabel left">To</span>
					<input class="filterField left" type="text" name="mangaFilter[id][value][to]" value="<?php echo $filters->getValueTo('id'); ?>"/>
				</div>
			</th>
			<th>
				<div class="clear">
					<input type="text" name="mangaFilter[name][value]" value="<?php echo $filters->getValue('name'); ?>" style="width: 89%"/>
					<input type="hidden" name="mangaFilter[name][type]" value="string"/>
				</div>						
			</th>
			<th>
				<div class="clear">
					<input type="text" name="mangaFilter[author][value]" value="<?php echo $filters->getValue('author'); ?>" style="width: 89%"/>
					<input type="hidden" name="mangaFilter[author][type]" value="string"/>
				</div>
			</th>
			<th>
				<div class="clear">
					<input type="text" name="mangaFilter[publisher][value]" value="<?php echo $filters->getValue('publisher'); ?>" style="width: 89%"/>
					<input type="hidden" name="mangaFilter[publisher][type]" value="string"/>
				</div>
			</th>
			<th></th>
			<th></th>
		</tr>
		</thead>
		<tbody>
			<?php foreach ($mangaCollection as $manga) :?>
			<tr id="row_<?php echo $manga->getId()?>" class="activeRow">
				<input class="editUrl" type="hidden" value="<?php echo $manga->getMangaUrl(); ?>" />
				<td>
					<?php echo fx_control::newInstance('chkMangaId')
										 ->createType('checkbox')
										 ->binding($manga, 'id')
										 ->render(); 
					?>
				</td>
				<td><?php echo $manga->getId() ?></td>
				<td><?php echo $manga->getName() ?></td>
				<td><?php echo $manga->getAuthor() ?></td>
				<td><?php echo $manga->getPublisher() ?></td>
			</tr>
			<?php endforeach; ?>
		</tbody>
	</table>
</div>